/*
 *
 *      Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the pig4cloud.com developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: lengleng (wangiegie@gmail.com)
 *
 */

package com.pig4cloud.pigx.admin.service.impl;

import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.pigx.admin.api.dto.DraninageCurveDto;
import com.pig4cloud.pigx.admin.api.entity.OverallDrainageCurve;
import com.pig4cloud.pigx.admin.mapper.OverallDrainageCurveMapper;
import com.pig4cloud.pigx.admin.service.OverallDrainageCurveService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 四全泄流曲线数据 服务实现类
 * </p>
 *
 * @author lengleng
 * @since 2018-01-20
 */
@Service
@AllArgsConstructor
public class OverallDrainageCurveServiceImpl extends ServiceImpl<OverallDrainageCurveMapper, OverallDrainageCurve> implements OverallDrainageCurveService {


    private final OverallDrainageCurveMapper mapper;


    /**
     *
     * @param res
     * @return List<OverallDrainageCurve>
     * @author lfx
     * @date 2024/8/10 15:19
     * @Desc 查询泄洪曲线列表数据
     **/
    @Override
    public List<OverallDrainageCurve> selectList(DraninageCurveDto res) {
        Assert.notNull(res, "参数不能为空");
        List<OverallDrainageCurve> drainageCurves = mapper.selectList(Wrappers.lambdaQuery(OverallDrainageCurve.class)
                .eq(StringUtils.isNotEmpty(res.getReservoirId()), OverallDrainageCurve::getReservoirId, res.getReservoirId())
                .eq(StringUtils.isNotEmpty(res.getTime()), OverallDrainageCurve::getTime, res.getTime()));
        return drainageCurves;
    }
}
